<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>spade.kb</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="spade-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://spade2.googlecode.com">SPADE</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="spade-module.html">Package&nbsp;spade</a> ::
        Module&nbsp;kb
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="spade.kb-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="spade.kb-module.html">Module spade.kb</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Module spade.logic=spade.logic-module.html"><a title="spade.logic" class="py-name" href="#" onclick="return doclink('link-0', 'logic', 'link-0');">logic</a></tt> <tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Class spade.logic.FolKB=spade.logic.FolKB-class.html"><a title="spade.logic.FolKB" class="py-name" href="#" onclick="return doclink('link-1', 'FolKB', 'link-1');">FolKB</a></tt><tt class="py-op">,</tt> <tt id="link-2" class="py-name" targets="Function spade.logic.fol_bc_ask()=spade.logic-module.html#fol_bc_ask"><a title="spade.logic.fol_bc_ask" class="py-name" href="#" onclick="return doclink('link-2', 'fol_bc_ask', 'link-2');">fol_bc_ask</a></tt><tt class="py-op">,</tt> <tt id="link-3" class="py-name" targets="Function spade.logic.expr()=spade.logic-module.html#expr"><a title="spade.logic.expr" class="py-name" href="#" onclick="return doclink('link-3', 'expr', 'link-3');">expr</a></tt><tt class="py-op">,</tt> <tt id="link-4" class="py-name" targets="Function spade.logic.is_definite_clause()=spade.logic-module.html#is_definite_clause"><a title="spade.logic.is_definite_clause" class="py-name" href="#" onclick="return doclink('link-4', 'is_definite_clause', 'link-4');">is_definite_clause</a></tt><tt class="py-op">,</tt> <tt id="link-5" class="py-name" targets="Function spade.logic.variables()=spade.logic-module.html#variables"><a title="spade.logic.variables" class="py-name" href="#" onclick="return doclink('link-5', 'variables', 'link-5');">variables</a></tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">random</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">string</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-6" class="py-name" targets="Variable spade.bdi.Goal.types=spade.bdi.Goal-class.html#types"><a title="spade.bdi.Goal.types" class="py-name" href="#" onclick="return doclink('link-6', 'types', 'link-6');">types</a></tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"> </tt>
<a name="KBNameNotString"></a><div id="KBNameNotString-def"><a name="L7"></a><tt class="py-lineno">  7</tt> <a class="py-toggle" href="#" id="KBNameNotString-toggle" onclick="return toggle('KBNameNotString');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="spade.kb.KBNameNotString-class.html">KBNameNotString</a><tt class="py-op">(</tt><tt class="py-base-class">Exception</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-keyword">pass</tt> </tt>
</div><a name="KBValueNotKnown"></a><div id="KBValueNotKnown-def"><a name="L8"></a><tt class="py-lineno">  8</tt> <a class="py-toggle" href="#" id="KBValueNotKnown-toggle" onclick="return toggle('KBValueNotKnown');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="spade.kb.KBValueNotKnown-class.html">KBValueNotKnown</a><tt class="py-op">(</tt><tt class="py-base-class">Exception</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-keyword">pass</tt> </tt>
</div><a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"> </tt>
<a name="KBConfigurationFailed"></a><div id="KBConfigurationFailed-def"><a name="L10"></a><tt class="py-lineno"> 10</tt> <a class="py-toggle" href="#" id="KBConfigurationFailed-toggle" onclick="return toggle('KBConfigurationFailed');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="spade.kb.KBConfigurationFailed-class.html">KBConfigurationFailed</a><tt class="py-op">(</tt><tt class="py-base-class">Exception</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="KBConfigurationFailed-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="KBConfigurationFailed-expanded"><a name="KBConfigurationFailed.__init__"></a><div id="KBConfigurationFailed.__init__-def"><a name="L11"></a><tt class="py-lineno"> 11</tt> <a class="py-toggle" href="#" id="KBConfigurationFailed.__init__-toggle" onclick="return toggle('KBConfigurationFailed.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.KBConfigurationFailed-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">msg</tt><tt class="py-op">=</tt><tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="KBConfigurationFailed.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="KBConfigurationFailed.__init__-expanded"><a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-7" class="py-name" targets="Variable spade.pyparsing.ParseBaseException.msg=spade.pyparsing.ParseBaseException-class.html#msg"><a title="spade.pyparsing.ParseBaseException.msg" class="py-name" href="#" onclick="return doclink('link-7', 'msg', 'link-7');">msg</a></tt> <tt class="py-op">=</tt> <tt id="link-8" class="py-name"><a title="spade.pyparsing.ParseBaseException.msg" class="py-name" href="#" onclick="return doclink('link-8', 'msg', 'link-7');">msg</a></tt> </tt>
</div><a name="KBConfigurationFailed.__str__"></a><div id="KBConfigurationFailed.__str__-def"><a name="L13"></a><tt class="py-lineno"> 13</tt> <a class="py-toggle" href="#" id="KBConfigurationFailed.__str__-toggle" onclick="return toggle('KBConfigurationFailed.__str__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.KBConfigurationFailed-class.html#__str__">__str__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="KBConfigurationFailed.__str__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="KBConfigurationFailed.__str__-expanded"><a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">repr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-9" class="py-name"><a title="spade.pyparsing.ParseBaseException.msg" class="py-name" href="#" onclick="return doclink('link-9', 'msg', 'link-7');">msg</a></tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"> </tt>
<a name="SpadeKB"></a><div id="SpadeKB-def"><a name="L16"></a><tt class="py-lineno"> 16</tt> <a class="py-toggle" href="#" id="SpadeKB-toggle" onclick="return toggle('SpadeKB');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="spade.kb.SpadeKB-class.html">SpadeKB</a><tt class="py-op">(</tt><tt class="py-base-class">FolKB</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SpadeKB-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="SpadeKB-expanded"><a name="SpadeKB.tell"></a><div id="SpadeKB.tell-def"><a name="L17"></a><tt class="py-lineno"> 17</tt> <a class="py-toggle" href="#" id="SpadeKB.tell-toggle" onclick="return toggle('SpadeKB.tell');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.SpadeKB-class.html#tell">tell</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">sentence</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SpadeKB.tell-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SpadeKB.tell-expanded"><a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">issubclass</tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt><tt class="py-op">,</tt><tt class="py-name">str</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line">            <tt class="py-name">sentence</tt> <tt class="py-op">=</tt> <tt id="link-10" class="py-name"><a title="spade.logic.expr" class="py-name" href="#" onclick="return doclink('link-10', 'expr', 'link-3');">expr</a></tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">)</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-11" class="py-name"><a title="spade.logic.is_definite_clause" class="py-name" href="#" onclick="return doclink('link-11', 'is_definite_clause', 'link-4');">is_definite_clause</a></tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">clauses</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name" targets="Method spade.pyparsing.ParseExpression.append()=spade.pyparsing.ParseExpression-class.html#append"><a title="spade.pyparsing.ParseExpression.append" class="py-name" href="#" onclick="return doclink('link-12', 'append', 'link-12');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">)</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">Exception</tt><tt class="py-op">(</tt><tt class="py-string">"Not a definite clause: %s"</tt> <tt class="py-op">%</tt> <tt class="py-name">sentence</tt><tt class="py-op">)</tt> </tt>
</div><a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"> </tt>
<a name="SpadeKB.retract"></a><div id="SpadeKB.retract-def"><a name="L25"></a><tt class="py-lineno"> 25</tt> <a class="py-toggle" href="#" id="SpadeKB.retract-toggle" onclick="return toggle('SpadeKB.retract');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.SpadeKB-class.html#retract">retract</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">sentence</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SpadeKB.retract-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SpadeKB.retract-expanded"><a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">issubclass</tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt><tt class="py-op">,</tt><tt class="py-name">str</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line">            <tt class="py-name">sentence</tt> <tt class="py-op">=</tt> <tt id="link-13" class="py-name"><a title="spade.logic.expr" class="py-name" href="#" onclick="return doclink('link-13', 'expr', 'link-3');">expr</a></tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">)</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">clauses</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name" targets="Method spade.FlexQueue.FlexQueue.remove()=spade.FlexQueue.FlexQueue-class.html#remove"><a title="spade.FlexQueue.FlexQueue.remove" class="py-name" href="#" onclick="return doclink('link-14', 'remove', 'link-14');">remove</a></tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">)</tt> </tt>
</div><a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"> </tt>
<a name="SpadeKB.ask"></a><div id="SpadeKB.ask-def"><a name="L30"></a><tt class="py-lineno"> 30</tt> <a class="py-toggle" href="#" id="SpadeKB.ask-toggle" onclick="return toggle('SpadeKB.ask');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.SpadeKB-class.html#ask">ask</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">q</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SpadeKB.ask-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SpadeKB.ask-expanded"><a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line">        <tt id="link-15" class="py-name" targets="Variable spade.xmppd.modules.stream.e=spade.xmppd.modules.stream-module.html#e,Variable spade.xmppd.xmppd.e=spade.xmppd.xmppd-module.html#e"><a title="spade.xmppd.modules.stream.e
spade.xmppd.xmppd.e" class="py-name" href="#" onclick="return doclink('link-15', 'e', 'link-15');">e</a></tt> <tt class="py-op">=</tt> <tt id="link-16" class="py-name"><a title="spade.logic.expr" class="py-name" href="#" onclick="return doclink('link-16', 'expr', 'link-3');">expr</a></tt><tt class="py-op">(</tt><tt class="py-name">q</tt><tt class="py-op">)</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line">        <tt class="py-name">vars</tt> <tt class="py-op">=</tt> <tt id="link-17" class="py-name"><a title="spade.logic.variables" class="py-name" href="#" onclick="return doclink('link-17', 'variables', 'link-5');">variables</a></tt><tt class="py-op">(</tt><tt id="link-18" class="py-name"><a title="spade.xmppd.modules.stream.e
spade.xmppd.xmppd.e" class="py-name" href="#" onclick="return doclink('link-18', 'e', 'link-15');">e</a></tt><tt class="py-op">)</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">        <tt class="py-name">ans</tt> <tt class="py-op">=</tt> <tt id="link-19" class="py-name"><a title="spade.logic.fol_bc_ask" class="py-name" href="#" onclick="return doclink('link-19', 'fol_bc_ask', 'link-2');">fol_bc_ask</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt id="link-20" class="py-name"><a title="spade.xmppd.modules.stream.e
spade.xmppd.xmppd.e" class="py-name" href="#" onclick="return doclink('link-20', 'e', 'link-15');">e</a></tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">        <tt class="py-name">res</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt id="link-21" class="py-name" targets="Variable spade.ACLMessage.ACLMessage.a=spade.ACLMessage.ACLMessage-class.html#a"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-21', 'a', 'link-21');">a</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">ans</tt><tt class="py-op">:</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">            <tt class="py-name">res</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name"><a title="spade.pyparsing.ParseExpression.append" class="py-name" href="#" onclick="return doclink('link-22', 'append', 'link-12');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">dict</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-op">(</tt><tt id="link-23" class="py-name" targets="Variable spade.Agent.x=spade.Agent-module.html#x,Variable spade.bdi.x=spade.bdi-module.html#x,Variable spade.logic.x=spade.logic-module.html#x"><a title="spade.Agent.x
spade.bdi.x
spade.logic.x" class="py-name" href="#" onclick="return doclink('link-23', 'x', 'link-23');">x</a></tt><tt class="py-op">,</tt> <tt class="py-name">v</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt class="py-op">(</tt><tt id="link-24" class="py-name"><a title="spade.Agent.x
spade.bdi.x
spade.logic.x" class="py-name" href="#" onclick="return doclink('link-24', 'x', 'link-23');">x</a></tt><tt class="py-op">,</tt> <tt class="py-name">v</tt><tt class="py-op">)</tt> <tt class="py-keyword">in</tt> <tt id="link-25" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-25', 'a', 'link-21');">a</a></tt><tt class="py-op">.</tt><tt id="link-26" class="py-name" targets="Method spade.odict.odict.items()=spade.odict.odict-class.html#items,Method spade.pyparsing.ParseResults.items()=spade.pyparsing.ParseResults-class.html#items"><a title="spade.odict.odict.items
spade.pyparsing.ParseResults.items" class="py-name" href="#" onclick="return doclink('link-26', 'items', 'link-26');">items</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-keyword">if</tt> <tt id="link-27" class="py-name"><a title="spade.Agent.x
spade.bdi.x
spade.logic.x" class="py-name" href="#" onclick="return doclink('link-27', 'x', 'link-23');">x</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">vars</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">        <tt class="py-name">res</tt><tt class="py-op">.</tt><tt id="link-28" class="py-name" targets="Method spade.odict.odict.sort()=spade.odict.odict-class.html#sort"><a title="spade.odict.odict.sort" class="py-name" href="#" onclick="return doclink('link-28', 'sort', 'link-28');">sort</a></tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">=</tt><tt class="py-name">str</tt><tt class="py-op">)</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">         </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">res</tt><tt class="py-op">==</tt><tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">r</tt> <tt class="py-keyword">in</tt> <tt class="py-name">res</tt><tt class="py-op">:</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">r</tt><tt class="py-op">!=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">:</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">res</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> <tt class="py-comment">#res is a list of empty dicts</tt> </tt>
</div><a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"> </tt>
<a name="SpadeKB._encode"></a><div id="SpadeKB._encode-def"><a name="L45"></a><tt class="py-lineno"> 45</tt> <a class="py-toggle" href="#" id="SpadeKB._encode-toggle" onclick="return toggle('SpadeKB._encode');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.SpadeKB-class.html#_encode">_encode</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">key</tt><tt class="py-op">,</tt><tt class="py-param">value</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SpadeKB._encode-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SpadeKB._encode-expanded"><a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">        <tt class="py-name">key</tt> <tt class="py-op">=</tt> <tt class="py-name">key</tt><tt class="py-op">.</tt><tt class="py-name">capitalize</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">issubclass</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt><tt class="py-op">,</tt> <tt class="py-name">str</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-29" class="py-name" targets="Method spade.ECLiPSeKB.ECLiPSeKB.tell()=spade.ECLiPSeKB.ECLiPSeKB-class.html#tell,Method spade.Flora2KB.Flora2KB.tell()=spade.Flora2KB.Flora2KB-class.html#tell,Method spade.SPARQLKB.SPARQLKB.tell()=spade.SPARQLKB.SPARQLKB-class.html#tell,Method spade.SWIKB.SWIKB.tell()=spade.SWIKB.SWIKB-class.html#tell,Method spade.XSBKB.XSBKB.tell()=spade.XSBKB.XSBKB-class.html#tell,Method spade.kb.KB.tell()=spade.kb.KB-class.html#tell,Method spade.kb.SpadeKB.tell()=spade.kb.SpadeKB-class.html#tell,Method spade.logic.FolKB.tell()=spade.logic.FolKB-class.html#tell,Method spade.logic.KB.tell()=spade.logic.KB-class.html#tell,Method spade.logic.PropHornKB.tell()=spade.logic.PropHornKB-class.html#tell,Method spade.logic.PropKB.tell()=spade.logic.PropKB-class.html#tell"><a title="spade.ECLiPSeKB.ECLiPSeKB.tell
spade.Flora2KB.Flora2KB.tell
spade.SPARQLKB.SPARQLKB.tell
spade.SWIKB.SWIKB.tell
spade.XSBKB.XSBKB.tell
spade.kb.KB.tell
spade.kb.SpadeKB.tell
spade.logic.FolKB.tell
spade.logic.KB.tell
spade.logic.PropHornKB.tell
spade.logic.PropKB.tell" class="py-name" href="#" onclick="return doclink('link-29', 'tell', 'link-29');">tell</a></tt><tt class="py-op">(</tt><tt class="py-string">"Var("</tt><tt class="py-op">+</tt><tt class="py-name">key</tt><tt class="py-op">+</tt><tt class="py-string">","</tt><tt class="py-op">+</tt><tt class="py-name">value</tt><tt class="py-op">.</tt><tt class="py-name">capitalize</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">+</tt><tt class="py-string">",Str)"</tt><tt class="py-op">)</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">issubclass</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt><tt class="py-op">,</tt><tt class="py-name">int</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-30" class="py-name"><a title="spade.ECLiPSeKB.ECLiPSeKB.tell
spade.Flora2KB.Flora2KB.tell
spade.SPARQLKB.SPARQLKB.tell
spade.SWIKB.SWIKB.tell
spade.XSBKB.XSBKB.tell
spade.kb.KB.tell
spade.kb.SpadeKB.tell
spade.logic.FolKB.tell
spade.logic.KB.tell
spade.logic.PropHornKB.tell
spade.logic.PropKB.tell" class="py-name" href="#" onclick="return doclink('link-30', 'tell', 'link-29');">tell</a></tt><tt class="py-op">(</tt><tt class="py-string">"Var("</tt><tt class="py-op">+</tt><tt class="py-name">key</tt><tt class="py-op">+</tt><tt class="py-string">","</tt><tt class="py-op">+</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">)</tt><tt class="py-op">+</tt><tt class="py-string">",Int)"</tt><tt class="py-op">)</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">issubclass</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt><tt class="py-op">,</tt><tt class="py-name">float</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-31" class="py-name"><a title="spade.ECLiPSeKB.ECLiPSeKB.tell
spade.Flora2KB.Flora2KB.tell
spade.SPARQLKB.SPARQLKB.tell
spade.SWIKB.SWIKB.tell
spade.XSBKB.XSBKB.tell
spade.kb.KB.tell
spade.kb.SpadeKB.tell
spade.logic.FolKB.tell
spade.logic.KB.tell
spade.logic.PropHornKB.tell
spade.logic.PropKB.tell" class="py-name" href="#" onclick="return doclink('link-31', 'tell', 'link-29');">tell</a></tt><tt class="py-op">(</tt><tt class="py-string">"Var("</tt><tt class="py-op">+</tt><tt class="py-name">key</tt><tt class="py-op">+</tt><tt class="py-string">","</tt><tt class="py-op">+</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-string">",Float)"</tt><tt class="py-op">)</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">issubclass</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt><tt class="py-op">,</tt><tt class="py-name">list</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">            <tt class="py-name">listID</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">random</tt><tt class="py-op">.</tt><tt class="py-name">choice</tt><tt class="py-op">(</tt><tt class="py-name">string</tt><tt class="py-op">.</tt><tt class="py-name">ascii_uppercase</tt><tt class="py-op">+</tt><tt class="py-name">string</tt><tt class="py-op">.</tt><tt class="py-name">ascii_lowercase</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt id="link-32" class="py-name"><a title="spade.Agent.x
spade.bdi.x
spade.logic.x" class="py-name" href="#" onclick="return doclink('link-32', 'x', 'link-23');">x</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-number">8</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">            <tt class="py-name">listID</tt> <tt class="py-op">=</tt> <tt class="py-name">listID</tt><tt class="py-op">.</tt><tt class="py-name">capitalize</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-comment">#listID.replace(listID[0],listID[0].lower(),1)</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">elem</tt> <tt class="py-keyword">in</tt> <tt class="py-name">value</tt><tt class="py-op">:</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-33" class="py-name" targets="Method spade.kb.SpadeKB._encode()=spade.kb.SpadeKB-class.html#_encode"><a title="spade.kb.SpadeKB._encode" class="py-name" href="#" onclick="return doclink('link-33', '_encode', 'link-33');">_encode</a></tt><tt class="py-op">(</tt><tt class="py-name">listID</tt><tt class="py-op">,</tt> <tt class="py-name">elem</tt><tt class="py-op">)</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-34" class="py-name"><a title="spade.ECLiPSeKB.ECLiPSeKB.tell
spade.Flora2KB.Flora2KB.tell
spade.SPARQLKB.SPARQLKB.tell
spade.SWIKB.SWIKB.tell
spade.XSBKB.XSBKB.tell
spade.kb.KB.tell
spade.kb.SpadeKB.tell
spade.logic.FolKB.tell
spade.logic.KB.tell
spade.logic.PropHornKB.tell
spade.logic.PropKB.tell" class="py-name" href="#" onclick="return doclink('link-34', 'tell', 'link-29');">tell</a></tt><tt class="py-op">(</tt><tt class="py-string">"Var("</tt><tt class="py-op">+</tt> <tt class="py-name">key</tt> <tt class="py-op">+</tt> <tt class="py-string">","</tt><tt class="py-op">+</tt> <tt class="py-name">listID</tt> <tt class="py-op">+</tt><tt class="py-string">",List)"</tt><tt class="py-op">)</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">issubclass</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt><tt class="py-op">,</tt><tt class="py-name">dict</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">            <tt class="py-name">dictID</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">random</tt><tt class="py-op">.</tt><tt class="py-name">choice</tt><tt class="py-op">(</tt><tt class="py-name">string</tt><tt class="py-op">.</tt><tt class="py-name">ascii_uppercase</tt><tt class="py-op">+</tt><tt class="py-name">string</tt><tt class="py-op">.</tt><tt class="py-name">ascii_lowercase</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt id="link-35" class="py-name"><a title="spade.Agent.x
spade.bdi.x
spade.logic.x" class="py-name" href="#" onclick="return doclink('link-35', 'x', 'link-23');">x</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-number">8</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">            <tt class="py-name">dictID</tt> <tt class="py-op">=</tt> <tt class="py-name">dictID</tt><tt class="py-op">.</tt><tt class="py-name">capitalize</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-comment">#listID.replace(listID[0],listID[0].lower(),1)</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">k</tt><tt class="py-op">,</tt><tt class="py-name">v</tt> <tt class="py-keyword">in</tt> <tt class="py-name">value</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name"><a title="spade.odict.odict.items
spade.pyparsing.ParseResults.items" class="py-name" href="#" onclick="return doclink('link-36', 'items', 'link-26');">items</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line">                <tt class="py-name">elemID</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">random</tt><tt class="py-op">.</tt><tt class="py-name">choice</tt><tt class="py-op">(</tt><tt class="py-name">string</tt><tt class="py-op">.</tt><tt class="py-name">ascii_uppercase</tt><tt class="py-op">+</tt><tt class="py-name">string</tt><tt class="py-op">.</tt><tt class="py-name">ascii_lowercase</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt id="link-37" class="py-name"><a title="spade.Agent.x
spade.bdi.x
spade.logic.x" class="py-name" href="#" onclick="return doclink('link-37', 'x', 'link-23');">x</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-number">8</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">                <tt class="py-name">elemID</tt> <tt class="py-op">=</tt> <tt class="py-name">elemID</tt><tt class="py-op">.</tt><tt class="py-name">capitalize</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-comment">#elemID.replace(elemID[0],elemID[0].lower(),1)</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-38" class="py-name"><a title="spade.kb.SpadeKB._encode" class="py-name" href="#" onclick="return doclink('link-38', '_encode', 'link-33');">_encode</a></tt><tt class="py-op">(</tt><tt class="py-name">elemID</tt><tt class="py-op">+</tt><tt class="py-string">"Key"</tt><tt class="py-op">,</tt><tt class="py-name">k</tt><tt class="py-op">)</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-39" class="py-name"><a title="spade.kb.SpadeKB._encode" class="py-name" href="#" onclick="return doclink('link-39', '_encode', 'link-33');">_encode</a></tt><tt class="py-op">(</tt><tt class="py-name">elemID</tt><tt class="py-op">+</tt><tt class="py-string">"Value"</tt><tt class="py-op">,</tt><tt class="py-name">v</tt><tt class="py-op">)</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name"><a title="spade.ECLiPSeKB.ECLiPSeKB.tell
spade.Flora2KB.Flora2KB.tell
spade.SPARQLKB.SPARQLKB.tell
spade.SWIKB.SWIKB.tell
spade.XSBKB.XSBKB.tell
spade.kb.KB.tell
spade.kb.SpadeKB.tell
spade.logic.FolKB.tell
spade.logic.KB.tell
spade.logic.PropHornKB.tell
spade.logic.PropKB.tell" class="py-name" href="#" onclick="return doclink('link-40', 'tell', 'link-29');">tell</a></tt><tt class="py-op">(</tt><tt class="py-string">"Pair("</tt><tt class="py-op">+</tt><tt class="py-name">dictID</tt><tt class="py-op">+</tt><tt class="py-string">","</tt><tt class="py-op">+</tt><tt class="py-name">elemID</tt><tt class="py-op">+</tt><tt class="py-string">")"</tt><tt class="py-op">)</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-41" class="py-name"><a title="spade.ECLiPSeKB.ECLiPSeKB.tell
spade.Flora2KB.Flora2KB.tell
spade.SPARQLKB.SPARQLKB.tell
spade.SWIKB.SWIKB.tell
spade.XSBKB.XSBKB.tell
spade.kb.KB.tell
spade.kb.SpadeKB.tell
spade.logic.FolKB.tell
spade.logic.KB.tell
spade.logic.PropHornKB.tell
spade.logic.PropKB.tell" class="py-name" href="#" onclick="return doclink('link-41', 'tell', 'link-29');">tell</a></tt><tt class="py-op">(</tt><tt class="py-string">"Var("</tt><tt class="py-op">+</tt><tt class="py-name">key</tt><tt class="py-op">+</tt><tt class="py-string">","</tt><tt class="py-op">+</tt><tt class="py-name">dictID</tt><tt class="py-op">+</tt><tt class="py-string">",Dict)"</tt><tt class="py-op">)</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-42" class="py-name" targets="Class spade.kb.KBValueNotKnown=spade.kb.KBValueNotKnown-class.html"><a title="spade.kb.KBValueNotKnown" class="py-name" href="#" onclick="return doclink('link-42', 'KBValueNotKnown', 'link-42');">KBValueNotKnown</a></tt> </tt>
</div><a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"> </tt>
<a name="SpadeKB._decode"></a><div id="SpadeKB._decode-def"><a name="L77"></a><tt class="py-lineno"> 77</tt> <a class="py-toggle" href="#" id="SpadeKB._decode-toggle" onclick="return toggle('SpadeKB._decode');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.SpadeKB-class.html#_decode">_decode</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">key</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SpadeKB._decode-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SpadeKB._decode-expanded"><a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">        <tt class="py-name">gen</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-43" class="py-name" targets="Method spade.kb.SpadeKB._gen_decode()=spade.kb.SpadeKB-class.html#_gen_decode"><a title="spade.kb.SpadeKB._gen_decode" class="py-name" href="#" onclick="return doclink('link-43', '_gen_decode', 'link-43');">_gen_decode</a></tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">)</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">gen</tt><tt class="py-op">.</tt><tt class="py-name">next</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">StopIteration</tt><tt class="py-op">:</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt>
</div><a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line"> </tt>
<a name="SpadeKB._gen_decode"></a><div id="SpadeKB._gen_decode-def"><a name="L84"></a><tt class="py-lineno"> 84</tt> <a class="py-toggle" href="#" id="SpadeKB._gen_decode-toggle" onclick="return toggle('SpadeKB._gen_decode');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.SpadeKB-class.html#_gen_decode">_gen_decode</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">key</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SpadeKB._gen_decode-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SpadeKB._gen_decode-expanded"><a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">        <tt class="py-name">key</tt> <tt class="py-op">=</tt> <tt class="py-name">key</tt><tt class="py-op">.</tt><tt class="py-name">capitalize</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">        <tt class="py-name">results</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-44" class="py-name" targets="Method spade.ECLiPSeKB.ECLiPSeKB.ask()=spade.ECLiPSeKB.ECLiPSeKB-class.html#ask,Method spade.Flora2KB.Flora2KB.ask()=spade.Flora2KB.Flora2KB-class.html#ask,Method spade.SPARQLKB.SPARQLKB.ask()=spade.SPARQLKB.SPARQLKB-class.html#ask,Method spade.SWIKB.SWIKB.ask()=spade.SWIKB.SWIKB-class.html#ask,Method spade.XSBKB.XSBKB.ask()=spade.XSBKB.XSBKB-class.html#ask,Method spade.kb.KB.ask()=spade.kb.KB-class.html#ask,Method spade.kb.SpadeKB.ask()=spade.kb.SpadeKB-class.html#ask,Method spade.logic.KB.ask()=spade.logic.KB-class.html#ask"><a title="spade.ECLiPSeKB.ECLiPSeKB.ask
spade.Flora2KB.Flora2KB.ask
spade.SPARQLKB.SPARQLKB.ask
spade.SWIKB.SWIKB.ask
spade.XSBKB.XSBKB.ask
spade.kb.KB.ask
spade.kb.SpadeKB.ask
spade.logic.KB.ask" class="py-name" href="#" onclick="return doclink('link-44', 'ask', 'link-44');">ask</a></tt><tt class="py-op">(</tt><tt class="py-string">"Var("</tt><tt class="py-op">+</tt><tt class="py-name">key</tt><tt class="py-op">+</tt><tt class="py-string">", value, type)"</tt><tt class="py-op">)</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">type</tt><tt class="py-op">(</tt><tt class="py-name">results</tt><tt class="py-op">)</tt><tt class="py-op">==</tt><tt id="link-45" class="py-name"><a title="spade.bdi.Goal.types" class="py-name" href="#" onclick="return doclink('link-45', 'types', 'link-6');">types</a></tt><tt class="py-op">.</tt><tt class="py-name">BooleanType</tt><tt class="py-op">:</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">            <tt class="py-keyword">yield</tt> <tt class="py-name">None</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">res</tt> <tt class="py-keyword">in</tt>  <tt class="py-name">results</tt><tt class="py-op">:</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">            <tt class="py-name">value</tt> <tt class="py-op">=</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">res</tt><tt class="py-op">[</tt><tt id="link-46" class="py-name"><a title="spade.logic.expr" class="py-name" href="#" onclick="return doclink('link-46', 'expr', 'link-3');">expr</a></tt><tt class="py-op">(</tt><tt class="py-string">"value"</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">            <tt class="py-name">typ</tt>   <tt class="py-op">=</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">res</tt><tt class="py-op">[</tt><tt id="link-47" class="py-name"><a title="spade.logic.expr" class="py-name" href="#" onclick="return doclink('link-47', 'expr', 'link-3');">expr</a></tt><tt class="py-op">(</tt><tt class="py-string">"type"</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line"> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt>   <tt class="py-name">typ</tt> <tt class="py-op">==</tt> <tt class="py-string">"Int"</tt><tt class="py-op">:</tt> <tt class="py-keyword">yield</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">)</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">typ</tt> <tt class="py-op">==</tt> <tt class="py-string">"Str"</tt><tt class="py-op">:</tt> <tt class="py-keyword">yield</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">lower</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">typ</tt> <tt class="py-op">==</tt> <tt class="py-string">"Float"</tt><tt class="py-op">:</tt> <tt class="py-keyword">yield</tt> <tt class="py-name">float</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">)</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">typ</tt> <tt class="py-op">==</tt> <tt class="py-string">"List"</tt><tt class="py-op">:</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">                <tt class="py-name">l</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">                <tt class="py-name">listID</tt> <tt class="py-op">=</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">)</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">                <tt class="py-name">gen</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-48" class="py-name"><a title="spade.kb.SpadeKB._gen_decode" class="py-name" href="#" onclick="return doclink('link-48', '_gen_decode', 'link-43');">_gen_decode</a></tt><tt class="py-op">(</tt><tt class="py-name">listID</tt><tt class="py-op">)</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">                <tt class="py-name">hasElements</tt><tt class="py-op">=</tt><tt class="py-name">True</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">                <tt class="py-keyword">while</tt> <tt class="py-name">hasElements</tt><tt class="py-op">:</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">                    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">                        <tt class="py-name">l</tt><tt class="py-op">.</tt><tt id="link-49" class="py-name"><a title="spade.pyparsing.ParseExpression.append" class="py-name" href="#" onclick="return doclink('link-49', 'append', 'link-12');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">gen</tt><tt class="py-op">.</tt><tt class="py-name">next</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">                    <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">                        <tt class="py-name">hasElements</tt><tt class="py-op">=</tt><tt class="py-name">False</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">                <tt class="py-keyword">yield</tt> <tt class="py-name">l</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">typ</tt> <tt class="py-op">==</tt> <tt class="py-string">"Dict"</tt><tt class="py-op">:</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">                <tt class="py-name">dictID</tt> <tt class="py-op">=</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">)</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">                <tt id="link-50" class="py-name" targets="Function spade.logic.d()=spade.logic-module.html#d"><a title="spade.logic.d" class="py-name" href="#" onclick="return doclink('link-50', 'd', 'link-50');">d</a></tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">                <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-51" class="py-name"><a title="spade.ECLiPSeKB.ECLiPSeKB.ask
spade.Flora2KB.Flora2KB.ask
spade.SPARQLKB.SPARQLKB.ask
spade.SWIKB.SWIKB.ask
spade.XSBKB.XSBKB.ask
spade.kb.KB.ask
spade.kb.SpadeKB.ask
spade.logic.KB.ask" class="py-name" href="#" onclick="return doclink('link-51', 'ask', 'link-44');">ask</a></tt><tt class="py-op">(</tt><tt class="py-string">"Pair("</tt><tt class="py-op">+</tt><tt class="py-name">dictID</tt><tt class="py-op">+</tt><tt class="py-string">", elemid)"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">                    <tt class="py-name">elemID</tt> <tt class="py-op">=</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">i</tt><tt class="py-op">[</tt><tt id="link-52" class="py-name"><a title="spade.logic.expr" class="py-name" href="#" onclick="return doclink('link-52', 'expr', 'link-3');">expr</a></tt><tt class="py-op">(</tt><tt class="py-string">"elemid"</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">                    <tt class="py-name">newkey</tt>   <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-53" class="py-name"><a title="spade.kb.SpadeKB._gen_decode" class="py-name" href="#" onclick="return doclink('link-53', '_gen_decode', 'link-43');">_gen_decode</a></tt><tt class="py-op">(</tt><tt class="py-name">elemID</tt><tt class="py-op">+</tt><tt class="py-string">"Key"</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">next</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">                    <tt class="py-name">newvalue</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-54" class="py-name"><a title="spade.kb.SpadeKB._gen_decode" class="py-name" href="#" onclick="return doclink('link-54', '_gen_decode', 'link-43');">_gen_decode</a></tt><tt class="py-op">(</tt><tt class="py-name">elemID</tt><tt class="py-op">+</tt><tt class="py-string">"Value"</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">next</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">                    <tt id="link-55" class="py-name"><a title="spade.logic.d" class="py-name" href="#" onclick="return doclink('link-55', 'd', 'link-50');">d</a></tt><tt class="py-op">[</tt><tt class="py-name">newkey</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">newvalue</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">                <tt class="py-keyword">yield</tt> <tt id="link-56" class="py-name"><a title="spade.logic.d" class="py-name" href="#" onclick="return doclink('link-56', 'd', 'link-50');">d</a></tt>  </tt>
</div></div><a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">                     </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line"> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">                 </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line"> </tt>
<a name="KB"></a><div id="KB-def"><a name="L120"></a><tt class="py-lineno">120</tt> <a class="py-toggle" href="#" id="KB-toggle" onclick="return toggle('KB');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="spade.kb.KB-class.html">KB</a><tt class="py-op">:</tt> </tt>
</div><div id="KB-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="KB-expanded"><a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line"> </tt>
<a name="KB.__init__"></a><div id="KB.__init__-def"><a name="L122"></a><tt class="py-lineno">122</tt> <a class="py-toggle" href="#" id="KB.__init__-toggle" onclick="return toggle('KB.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.KB-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="KB.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="KB.__init__-expanded"><a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-57" class="py-name" targets="Module spade.kb=spade.kb-module.html"><a title="spade.kb" class="py-name" href="#" onclick="return doclink('link-57', 'kb', 'link-57');">kb</a></tt> <tt class="py-op">=</tt> <tt id="link-58" class="py-name" targets="Class spade.kb.SpadeKB=spade.kb.SpadeKB-class.html"><a title="spade.kb.SpadeKB" class="py-name" href="#" onclick="return doclink('link-58', 'SpadeKB', 'link-58');">SpadeKB</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">type</tt> <tt class="py-op">=</tt> <tt class="py-string">"Spade"</tt> </tt>
</div><a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line"> </tt>
<a name="KB.configure"></a><div id="KB.configure-def"><a name="L126"></a><tt class="py-lineno">126</tt> <a class="py-toggle" href="#" id="KB.configure-toggle" onclick="return toggle('KB.configure');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.KB-class.html#configure">configure</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">typ</tt><tt class="py-op">,</tt> <tt class="py-param">sentence</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">path</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="KB.configure-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="KB.configure-expanded"><a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line"><tt class="py-docstring">        Supported Knowledge Bases are: ["ECLiPSe", "Flora2", "SPARQL", "SWI", "XSB", "Spade"]</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">typ</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt class="py-string">"ECLiPSe"</tt><tt class="py-op">,</tt> <tt class="py-string">"Flora2"</tt><tt class="py-op">,</tt> <tt class="py-string">"SPARQL"</tt><tt class="py-op">,</tt> <tt class="py-string">"SWI"</tt><tt class="py-op">,</tt> <tt class="py-string">"XSB"</tt><tt class="py-op">,</tt> <tt class="py-string">"Spade"</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-59" class="py-name" targets="Class spade.kb.KBConfigurationFailed=spade.kb.KBConfigurationFailed-class.html"><a title="spade.kb.KBConfigurationFailed" class="py-name" href="#" onclick="return doclink('link-59', 'KBConfigurationFailed', 'link-59');">KBConfigurationFailed</a></tt><tt class="py-op">(</tt><tt class="py-name">typ</tt> <tt class="py-op">+</tt> <tt class="py-string">" is not a valid KB."</tt><tt class="py-op">)</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">typ</tt><tt class="py-op">==</tt><tt class="py-string">"Spade"</tt><tt class="py-op">:</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-60" class="py-name"><a title="spade.kb" class="py-name" href="#" onclick="return doclink('link-60', 'kb', 'link-57');">kb</a></tt> <tt class="py-op">=</tt> <tt id="link-61" class="py-name"><a title="spade.kb.SpadeKB" class="py-name" href="#" onclick="return doclink('link-61', 'SpadeKB', 'link-58');">SpadeKB</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt>   <tt class="py-name">typ</tt><tt class="py-op">==</tt><tt class="py-string">"SPARQL"</tt><tt class="py-op">:</tt> <tt class="py-keyword">import</tt> <tt id="link-62" class="py-name" targets="Module spade.SPARQLKB=spade.SPARQLKB-module.html,Class spade.SPARQLKB.SPARQLKB=spade.SPARQLKB.SPARQLKB-class.html"><a title="spade.SPARQLKB
spade.SPARQLKB.SPARQLKB" class="py-name" href="#" onclick="return doclink('link-62', 'SPARQLKB', 'link-62');">SPARQLKB</a></tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">typ</tt><tt class="py-op">==</tt><tt class="py-string">"XSB"</tt><tt class="py-op">:</tt>    <tt class="py-keyword">import</tt> <tt id="link-63" class="py-name" targets="Module spade.XSBKB=spade.XSBKB-module.html,Class spade.XSBKB.XSBKB=spade.XSBKB.XSBKB-class.html"><a title="spade.XSBKB
spade.XSBKB.XSBKB" class="py-name" href="#" onclick="return doclink('link-63', 'XSBKB', 'link-63');">XSBKB</a></tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">typ</tt><tt class="py-op">==</tt><tt class="py-string">"Flora2"</tt><tt class="py-op">:</tt> <tt class="py-keyword">import</tt> <tt id="link-64" class="py-name" targets="Module spade.Flora2KB=spade.Flora2KB-module.html,Class spade.Flora2KB.Flora2KB=spade.Flora2KB.Flora2KB-class.html"><a title="spade.Flora2KB
spade.Flora2KB.Flora2KB" class="py-name" href="#" onclick="return doclink('link-64', 'Flora2KB', 'link-64');">Flora2KB</a></tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">typ</tt><tt class="py-op">==</tt><tt class="py-string">"SWI"</tt><tt class="py-op">:</tt>    <tt class="py-keyword">import</tt> <tt id="link-65" class="py-name" targets="Module spade.SWIKB=spade.SWIKB-module.html,Class spade.SWIKB.SWIKB=spade.SWIKB.SWIKB-class.html"><a title="spade.SWIKB
spade.SWIKB.SWIKB" class="py-name" href="#" onclick="return doclink('link-65', 'SWIKB', 'link-65');">SWIKB</a></tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">typ</tt><tt class="py-op">==</tt><tt class="py-string">"ECLiPSe"</tt><tt class="py-op">:</tt><tt class="py-keyword">import</tt> <tt id="link-66" class="py-name" targets="Module spade.ECLiPSeKB=spade.ECLiPSeKB-module.html,Class spade.ECLiPSeKB.ECLiPSeKB=spade.ECLiPSeKB.ECLiPSeKB-class.html"><a title="spade.ECLiPSeKB
spade.ECLiPSeKB.ECLiPSeKB" class="py-name" href="#" onclick="return doclink('link-66', 'ECLiPSeKB', 'link-66');">ECLiPSeKB</a></tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> <tt class="py-keyword">raise</tt> <tt id="link-67" class="py-name"><a title="spade.kb.KBConfigurationFailed" class="py-name" href="#" onclick="return doclink('link-67', 'KBConfigurationFailed', 'link-59');">KBConfigurationFailed</a></tt><tt class="py-op">(</tt><tt class="py-string">"Could not import "</tt><tt class="py-op">+</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">typ</tt><tt class="py-op">)</tt><tt class="py-op">+</tt><tt class="py-string">" KB."</tt><tt class="py-op">)</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line"> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt id="link-68" class="py-name"><a title="spade.kb.KBConfigurationFailed" class="py-name" href="#" onclick="return doclink('link-68', 'KBConfigurationFailed', 'link-59');">KBConfigurationFailed</a></tt> <tt class="py-keyword">as</tt> <tt id="link-69" class="py-name"><a title="spade.xmppd.modules.stream.e
spade.xmppd.xmppd.e" class="py-name" href="#" onclick="return doclink('link-69', 'e', 'link-15');">e</a></tt><tt class="py-op">:</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line">            <tt class="py-comment">#self.myAgent.DEBUG(str(e)+" Using Fol KB.", 'warn')</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line">            <tt class="py-name">typ</tt> <tt class="py-op">=</tt> <tt class="py-string">"Spade"</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line"> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">type</tt> <tt class="py-op">=</tt> <tt class="py-name">typ</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line">        <tt class="py-name">typ</tt><tt class="py-op">+=</tt><tt class="py-string">"KB"</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line"> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">typ</tt><tt class="py-op">==</tt><tt class="py-string">"SpadeKB"</tt><tt class="py-op">:</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-70" class="py-name"><a title="spade.kb" class="py-name" href="#" onclick="return doclink('link-70', 'kb', 'link-57');">kb</a></tt> <tt class="py-op">=</tt> <tt id="link-71" class="py-name"><a title="spade.kb.SpadeKB" class="py-name" href="#" onclick="return doclink('link-71', 'SpadeKB', 'link-58');">SpadeKB</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">path</tt><tt class="py-op">!=</tt><tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-72" class="py-name"><a title="spade.kb" class="py-name" href="#" onclick="return doclink('link-72', 'kb', 'link-57');">kb</a></tt> <tt class="py-op">=</tt> <tt id="link-73" class="py-name" targets="Method spade.pyratemp.PseudoSandbox.eval()=spade.pyratemp.PseudoSandbox-class.html#eval"><a title="spade.pyratemp.PseudoSandbox.eval" class="py-name" href="#" onclick="return doclink('link-73', 'eval', 'link-73');">eval</a></tt><tt class="py-op">(</tt><tt class="py-name">typ</tt><tt class="py-op">+</tt><tt class="py-string">"."</tt><tt class="py-op">+</tt><tt class="py-name">typ</tt><tt class="py-op">+</tt><tt class="py-string">"("</tt><tt class="py-op">+</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">)</tt><tt class="py-op">+</tt><tt class="py-string">", '"</tt><tt class="py-op">+</tt><tt class="py-name">path</tt><tt class="py-op">+</tt><tt class="py-string">"')"</tt><tt class="py-op">)</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-74" class="py-name"><a title="spade.kb" class="py-name" href="#" onclick="return doclink('link-74', 'kb', 'link-57');">kb</a></tt> <tt class="py-op">=</tt> <tt id="link-75" class="py-name"><a title="spade.pyratemp.PseudoSandbox.eval" class="py-name" href="#" onclick="return doclink('link-75', 'eval', 'link-73');">eval</a></tt><tt class="py-op">(</tt><tt class="py-name">typ</tt><tt class="py-op">+</tt><tt class="py-string">"."</tt><tt class="py-op">+</tt><tt class="py-name">typ</tt><tt class="py-op">+</tt><tt class="py-string">"("</tt><tt class="py-op">+</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">)</tt><tt class="py-op">+</tt><tt class="py-string">")"</tt><tt class="py-op">)</tt> </tt>
</div><a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line"> </tt>
<a name="KB.tell"></a><div id="KB.tell-def"><a name="L157"></a><tt class="py-lineno">157</tt> <a class="py-toggle" href="#" id="KB.tell-toggle" onclick="return toggle('KB.tell');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.KB-class.html#tell">tell</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">sentence</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="KB.tell-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="KB.tell-expanded"><a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-76" class="py-name"><a title="spade.kb" class="py-name" href="#" onclick="return doclink('link-76', 'kb', 'link-57');">kb</a></tt><tt class="py-op">.</tt><tt id="link-77" class="py-name"><a title="spade.ECLiPSeKB.ECLiPSeKB.tell
spade.Flora2KB.Flora2KB.tell
spade.SPARQLKB.SPARQLKB.tell
spade.SWIKB.SWIKB.tell
spade.XSBKB.XSBKB.tell
spade.kb.KB.tell
spade.kb.SpadeKB.tell
spade.logic.FolKB.tell
spade.logic.KB.tell
spade.logic.PropHornKB.tell
spade.logic.PropKB.tell" class="py-name" href="#" onclick="return doclink('link-77', 'tell', 'link-29');">tell</a></tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">)</tt> </tt>
</div><a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line"> </tt>
<a name="KB.retract"></a><div id="KB.retract-def"><a name="L160"></a><tt class="py-lineno">160</tt> <a class="py-toggle" href="#" id="KB.retract-toggle" onclick="return toggle('KB.retract');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.KB-class.html#retract">retract</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">sentence</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="KB.retract-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="KB.retract-expanded"><a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-78" class="py-name"><a title="spade.kb" class="py-name" href="#" onclick="return doclink('link-78', 'kb', 'link-57');">kb</a></tt><tt class="py-op">.</tt><tt id="link-79" class="py-name" targets="Method spade.ECLiPSeKB.ECLiPSeKB.retract()=spade.ECLiPSeKB.ECLiPSeKB-class.html#retract,Method spade.Flora2KB.Flora2KB.retract()=spade.Flora2KB.Flora2KB-class.html#retract,Method spade.SPARQLKB.SPARQLKB.retract()=spade.SPARQLKB.SPARQLKB-class.html#retract,Method spade.SWIKB.SWIKB.retract()=spade.SWIKB.SWIKB-class.html#retract,Method spade.XSBKB.XSBKB.retract()=spade.XSBKB.XSBKB-class.html#retract,Method spade.kb.KB.retract()=spade.kb.KB-class.html#retract,Method spade.kb.SpadeKB.retract()=spade.kb.SpadeKB-class.html#retract,Method spade.logic.FolKB.retract()=spade.logic.FolKB-class.html#retract,Method spade.logic.KB.retract()=spade.logic.KB-class.html#retract,Method spade.logic.PropHornKB.retract()=spade.logic.PropHornKB-class.html#retract,Method spade.logic.PropKB.retract()=spade.logic.PropKB-class.html#retract"><a title="spade.ECLiPSeKB.ECLiPSeKB.retract
spade.Flora2KB.Flora2KB.retract
spade.SPARQLKB.SPARQLKB.retract
spade.SWIKB.SWIKB.retract
spade.XSBKB.XSBKB.retract
spade.kb.KB.retract
spade.kb.SpadeKB.retract
spade.logic.FolKB.retract
spade.logic.KB.retract
spade.logic.PropHornKB.retract
spade.logic.PropKB.retract" class="py-name" href="#" onclick="return doclink('link-79', 'retract', 'link-79');">retract</a></tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">)</tt> </tt>
</div><a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line"> </tt>
<a name="KB.ask"></a><div id="KB.ask-def"><a name="L163"></a><tt class="py-lineno">163</tt> <a class="py-toggle" href="#" id="KB.ask-toggle" onclick="return toggle('KB.ask');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.KB-class.html#ask">ask</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">sentence</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="KB.ask-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="KB.ask-expanded"><a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-80" class="py-name"><a title="spade.kb" class="py-name" href="#" onclick="return doclink('link-80', 'kb', 'link-57');">kb</a></tt><tt class="py-op">.</tt><tt id="link-81" class="py-name"><a title="spade.ECLiPSeKB.ECLiPSeKB.ask
spade.Flora2KB.Flora2KB.ask
spade.SPARQLKB.SPARQLKB.ask
spade.SWIKB.SWIKB.ask
spade.XSBKB.XSBKB.ask
spade.kb.KB.ask
spade.kb.SpadeKB.ask
spade.logic.KB.ask" class="py-name" href="#" onclick="return doclink('link-81', 'ask', 'link-44');">ask</a></tt><tt class="py-op">(</tt><tt class="py-name">sentence</tt><tt class="py-op">)</tt> </tt>
</div><a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line"> </tt>
<a name="KB.set"></a><div id="KB.set-def"><a name="L166"></a><tt class="py-lineno">166</tt> <a class="py-toggle" href="#" id="KB.set-toggle" onclick="return toggle('KB.set');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.KB-class.html#set">set</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">key</tt><tt class="py-op">,</tt> <tt class="py-param">value</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="KB.set-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="KB.set-expanded"><a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">issubclass</tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt><tt class="py-op">,</tt> <tt class="py-name">str</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-82" class="py-name" targets="Class spade.kb.KBNameNotString=spade.kb.KBNameNotString-class.html"><a title="spade.kb.KBNameNotString" class="py-name" href="#" onclick="return doclink('link-82', 'KBNameNotString', 'link-82');">KBNameNotString</a></tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line"> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-83" class="py-name"><a title="spade.kb" class="py-name" href="#" onclick="return doclink('link-83', 'kb', 'link-57');">kb</a></tt><tt class="py-op">.</tt><tt id="link-84" class="py-name"><a title="spade.kb.SpadeKB._encode" class="py-name" href="#" onclick="return doclink('link-84', '_encode', 'link-33');">_encode</a></tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">,</tt><tt class="py-name">value</tt><tt class="py-op">)</tt> </tt>
</div><a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line"> </tt>
<a name="KB.get"></a><div id="KB.get-def"><a name="L172"></a><tt class="py-lineno">172</tt> <a class="py-toggle" href="#" id="KB.get-toggle" onclick="return toggle('KB.get');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="spade.kb.KB-class.html#get">get</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">key</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="KB.get-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="KB.get-expanded"><a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-85" class="py-name"><a title="spade.kb" class="py-name" href="#" onclick="return doclink('link-85', 'kb', 'link-57');">kb</a></tt><tt class="py-op">.</tt><tt id="link-86" class="py-name" targets="Method spade.kb.SpadeKB._decode()=spade.kb.SpadeKB-class.html#_decode"><a title="spade.kb.SpadeKB._decode" class="py-name" href="#" onclick="return doclink('link-86', '_decode', 'link-86');">_decode</a></tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line"> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line"> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">"__main__"</tt><tt class="py-op">:</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line"> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line">    <tt class="py-name">kb0</tt> <tt class="py-op">=</tt> <tt id="link-87" class="py-name" targets="Class spade.kb.KB=spade.kb.KB-class.html,Class spade.logic.KB=spade.logic.KB-class.html"><a title="spade.kb.KB
spade.logic.KB" class="py-name" href="#" onclick="return doclink('link-87', 'KB', 'link-87');">KB</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line"> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line">    <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-88" class="py-name" targets="Method spade.kb.KB.set()=spade.kb.KB-class.html#set"><a title="spade.kb.KB.set" class="py-name" href="#" onclick="return doclink('link-88', 'set', 'link-88');">set</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname1"</tt><tt class="py-op">,</tt><tt class="py-number">1234</tt><tt class="py-op">)</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line">    <tt id="link-89" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-89', 'a', 'link-21');">a</a></tt> <tt class="py-op">=</tt> <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-90" class="py-name" targets="Method spade.FlexQueue.FlexQueue.get()=spade.FlexQueue.FlexQueue-class.html#get,Method spade.kb.KB.get()=spade.kb.KB-class.html#get,Method spade.tbcbp.CaseDB.get()=spade.tbcbp.CaseDB-class.html#get,Method spade.xmppd.modules.db_fake.DB.get()=spade.xmppd.modules.db_fake.DB-class.html#get"><a title="spade.FlexQueue.FlexQueue.get
spade.kb.KB.get
spade.tbcbp.CaseDB.get
spade.xmppd.modules.db_fake.DB.get" class="py-name" href="#" onclick="return doclink('link-90', 'get', 'link-90');">get</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname1"</tt><tt class="py-op">)</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt id="link-91" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-91', 'a', 'link-21');">a</a></tt><tt class="py-op">,</tt> <tt id="link-92" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-92', 'a', 'link-21');">a</a></tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line"> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line">    <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-93" class="py-name"><a title="spade.kb.KB.set" class="py-name" href="#" onclick="return doclink('link-93', 'set', 'link-88');">set</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname2"</tt><tt class="py-op">,</tt><tt class="py-string">"myString"</tt><tt class="py-op">)</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line">    <tt id="link-94" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-94', 'a', 'link-21');">a</a></tt> <tt class="py-op">=</tt> <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-95" class="py-name"><a title="spade.FlexQueue.FlexQueue.get
spade.kb.KB.get
spade.tbcbp.CaseDB.get
spade.xmppd.modules.db_fake.DB.get" class="py-name" href="#" onclick="return doclink('link-95', 'get', 'link-90');">get</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname2"</tt><tt class="py-op">)</tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt id="link-96" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-96', 'a', 'link-21');">a</a></tt><tt class="py-op">,</tt> <tt id="link-97" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-97', 'a', 'link-21');">a</a></tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line"> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">    <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-98" class="py-name"><a title="spade.kb.KB.set" class="py-name" href="#" onclick="return doclink('link-98', 'set', 'link-88');">set</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname3"</tt><tt class="py-op">,</tt><tt class="py-number">1.34</tt><tt class="py-op">)</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">    <tt id="link-99" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-99', 'a', 'link-21');">a</a></tt> <tt class="py-op">=</tt> <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-100" class="py-name"><a title="spade.FlexQueue.FlexQueue.get
spade.kb.KB.get
spade.tbcbp.CaseDB.get
spade.xmppd.modules.db_fake.DB.get" class="py-name" href="#" onclick="return doclink('link-100', 'get', 'link-90');">get</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname3"</tt><tt class="py-op">)</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt id="link-101" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-101', 'a', 'link-21');">a</a></tt><tt class="py-op">,</tt> <tt id="link-102" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-102', 'a', 'link-21');">a</a></tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line"> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line"> </tt>
<a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">    <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-103" class="py-name"><a title="spade.kb.KB.set" class="py-name" href="#" onclick="return doclink('link-103', 'set', 'link-88');">set</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname4"</tt><tt class="py-op">,</tt><tt class="py-op">[</tt><tt class="py-number">5</tt><tt class="py-op">,</tt><tt class="py-number">6</tt><tt class="py-op">,</tt><tt class="py-number">7</tt><tt class="py-op">,</tt><tt class="py-number">8</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">    <tt id="link-104" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-104', 'a', 'link-21');">a</a></tt> <tt class="py-op">=</tt> <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-105" class="py-name"><a title="spade.FlexQueue.FlexQueue.get
spade.kb.KB.get
spade.tbcbp.CaseDB.get
spade.xmppd.modules.db_fake.DB.get" class="py-name" href="#" onclick="return doclink('link-105', 'get', 'link-90');">get</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname4"</tt><tt class="py-op">)</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt id="link-106" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-106', 'a', 'link-21');">a</a></tt><tt class="py-op">,</tt> <tt id="link-107" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-107', 'a', 'link-21');">a</a></tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line"> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">    <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-108" class="py-name"><a title="spade.kb.KB.set" class="py-name" href="#" onclick="return doclink('link-108', 'set', 'link-88');">set</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname5"</tt><tt class="py-op">,</tt><tt class="py-op">[</tt><tt class="py-number">5</tt><tt class="py-op">,</tt><tt class="py-number">6.23</tt><tt class="py-op">,</tt><tt class="py-string">"7"</tt><tt class="py-op">,</tt><tt class="py-op">[</tt><tt class="py-number">8</tt><tt class="py-op">,</tt><tt class="py-number">9</tt><tt class="py-op">]</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line">    <tt id="link-109" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-109', 'a', 'link-21');">a</a></tt> <tt class="py-op">=</tt> <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-110" class="py-name"><a title="spade.FlexQueue.FlexQueue.get
spade.kb.KB.get
spade.tbcbp.CaseDB.get
spade.xmppd.modules.db_fake.DB.get" class="py-name" href="#" onclick="return doclink('link-110', 'get', 'link-90');">get</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname5"</tt><tt class="py-op">)</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt id="link-111" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-111', 'a', 'link-21');">a</a></tt><tt class="py-op">,</tt> <tt id="link-112" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-112', 'a', 'link-21');">a</a></tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line"> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line">    <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-113" class="py-name"><a title="spade.kb.KB.set" class="py-name" href="#" onclick="return doclink('link-113', 'set', 'link-88');">set</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname6"</tt><tt class="py-op">,</tt><tt class="py-op">{</tt><tt class="py-string">'a'</tt><tt class="py-op">:</tt><tt class="py-number">123</tt><tt class="py-op">,</tt><tt class="py-string">'b'</tt><tt class="py-op">:</tt><tt class="py-number">456</tt><tt class="py-op">,</tt><tt class="py-number">789</tt><tt class="py-op">:</tt><tt class="py-string">"c"</tt><tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line">    <tt id="link-114" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-114', 'a', 'link-21');">a</a></tt> <tt class="py-op">=</tt> <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-115" class="py-name"><a title="spade.FlexQueue.FlexQueue.get
spade.kb.KB.get
spade.tbcbp.CaseDB.get
spade.xmppd.modules.db_fake.DB.get" class="py-name" href="#" onclick="return doclink('link-115', 'get', 'link-90');">get</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname6"</tt><tt class="py-op">)</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt id="link-116" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-116', 'a', 'link-21');">a</a></tt><tt class="py-op">,</tt> <tt id="link-117" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-117', 'a', 'link-21');">a</a></tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line"> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line">    <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-118" class="py-name"><a title="spade.kb.KB.set" class="py-name" href="#" onclick="return doclink('link-118', 'set', 'link-88');">set</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname7"</tt><tt class="py-op">,</tt><tt class="py-op">{</tt><tt class="py-string">'a'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-number">123.25</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-string">'b'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">,</tt><tt class="py-number">5</tt><tt class="py-op">,</tt><tt class="py-number">6</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-number">789</tt><tt class="py-op">:</tt><tt class="py-op">{</tt><tt class="py-string">'a'</tt><tt class="py-op">:</tt><tt class="py-number">1</tt><tt class="py-op">,</tt><tt class="py-string">'b'</tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">}</tt><tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line">    <tt id="link-119" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-119', 'a', 'link-21');">a</a></tt> <tt class="py-op">=</tt> <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-120" class="py-name"><a title="spade.FlexQueue.FlexQueue.get
spade.kb.KB.get
spade.tbcbp.CaseDB.get
spade.xmppd.modules.db_fake.DB.get" class="py-name" href="#" onclick="return doclink('link-120', 'get', 'link-90');">get</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname7"</tt><tt class="py-op">)</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt id="link-121" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-121', 'a', 'link-21');">a</a></tt><tt class="py-op">,</tt> <tt id="link-122" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-122', 'a', 'link-21');">a</a></tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line"> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line">        <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-123" class="py-name"><a title="spade.kb.KB.set" class="py-name" href="#" onclick="return doclink('link-123', 'set', 'link-88');">set</a></tt><tt class="py-op">(</tt><tt class="py-number">123</tt><tt class="py-op">,</tt><tt class="py-string">"newvalue"</tt><tt class="py-op">)</tt> </tt>
<a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt> <tt id="link-124" class="py-name"><a title="spade.kb.KBNameNotString" class="py-name" href="#" onclick="return doclink('link-124', 'KBNameNotString', 'link-82');">KBNameNotString</a></tt><tt class="py-op">:</tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">"Test KBNameNotString passed."</tt> </tt>
<a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line"> </tt>
<a name="L214"></a><tt class="py-lineno">214</tt>  <tt class="py-line"> </tt>
<a name="A"></a><div id="A-def"><a name="L215"></a><tt class="py-lineno">215</tt> <a class="py-toggle" href="#" id="A-toggle" onclick="return toggle('A');">-</a><tt class="py-line">    <tt class="py-keyword">class</tt> <a class="py-def-name" href="spade.kb.A-class.html">A</a><tt class="py-op">:</tt> <tt class="py-keyword">pass</tt> </tt>
</div><a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L217"></a><tt class="py-lineno">217</tt>  <tt class="py-line">        <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-125" class="py-name"><a title="spade.kb.KB.set" class="py-name" href="#" onclick="return doclink('link-125', 'set', 'link-88');">set</a></tt><tt class="py-op">(</tt><tt class="py-string">"i8"</tt><tt class="py-op">,</tt> <tt id="link-126" class="py-name" targets="Variable spade.Agent.A=spade.Agent-module.html#A,Variable spade.bdi.A=spade.bdi-module.html#A,Variable spade.logic.A=spade.logic-module.html#A"><a title="spade.Agent.A
spade.bdi.A
spade.logic.A" class="py-name" href="#" onclick="return doclink('link-126', 'A', 'link-126');">A</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L218"></a><tt class="py-lineno">218</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt> <tt id="link-127" class="py-name"><a title="spade.kb.KBValueNotKnown" class="py-name" href="#" onclick="return doclink('link-127', 'KBValueNotKnown', 'link-42');">KBValueNotKnown</a></tt><tt class="py-op">:</tt> </tt>
<a name="L219"></a><tt class="py-lineno">219</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">"Test KBValueNotKnown passed."</tt> </tt>
<a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line"> </tt>
<a name="L221"></a><tt class="py-lineno">221</tt>  <tt class="py-line"> </tt>
<a name="L222"></a><tt class="py-lineno">222</tt>  <tt class="py-line">    <tt id="link-128" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-128', 'a', 'link-21');">a</a></tt> <tt class="py-op">=</tt> <tt class="py-name">kb0</tt><tt class="py-op">.</tt><tt id="link-129" class="py-name"><a title="spade.FlexQueue.FlexQueue.get
spade.kb.KB.get
spade.tbcbp.CaseDB.get
spade.xmppd.modules.db_fake.DB.get" class="py-name" href="#" onclick="return doclink('link-129', 'get', 'link-90');">get</a></tt><tt class="py-op">(</tt><tt class="py-string">"varname9"</tt><tt class="py-op">)</tt> </tt>
<a name="L223"></a><tt class="py-lineno">223</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt id="link-130" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-130', 'a', 'link-21');">a</a></tt><tt class="py-op">,</tt> <tt id="link-131" class="py-name"><a title="spade.ACLMessage.ACLMessage.a" class="py-name" href="#" onclick="return doclink('link-131', 'a', 'link-21');">a</a></tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt> </tt>
<a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line"> </tt>
<a name="L225"></a><tt class="py-lineno">225</tt>  <tt class="py-line">    <tt class="py-comment">#print kb0.kb.clauses</tt> </tt>
<a name="L226"></a><tt class="py-lineno">226</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="spade-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://spade2.googlecode.com">SPADE</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Wed Aug  1 18:45:03 2012
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
